{extend name='common/content' /} {block name="content"}
<style>
	/* 标签添加 搜索建议置顶显示 */
	
	.ui-widget-content {
		z-index: 29891017!important;
	}
</style>
<link rel="stylesheet" href="__PUBLIC__/static/plugs/tag/jquery.tag-editor.css?ver={:date('ymd')}" /> {block name="content"}

<form name="article" class="layui-form layui-box" style='padding:25px 30px 20px 0' action="__SELF__" data-auto="true" method="post">
	<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
		<div class="layui-tab-content">
			<div class="layui-tab-item layui-show">

				<div class="layui-form-item">
					<label class="layui-form-label">名称</label>
					<div class="layui-input-block">
						<input type="text" name="goods_name" value='{$vo.goods_name|default=""}' required="required" title="请输入名称" placeholder="请输入名称" class="layui-input">
					</div>
				</div>

				{if !empty($cateringclass)}
				<div class="layui-form-item" pane="">
					<label class="layui-form-label">餐饮分类</label>
					<div class="layui-input-block">
						{volist name='cateringclass' id='v'}
						<input type="checkbox" name="sc_id[]" lay-skin="primary" value="{$v.id}" title="{$v.name}" {if in_array($v.id,explode( ',',$vo.sc_id))}checked{/if}> {/volist}
					</div>
				</div>
				{/if}

				<div class="layui-form-item">
					<label class="layui-form-label">分类</label>
					<div class="layui-input-block">
						<select name='goods_category' class='layui-select full-width' required="required">
							<option value="">请选择分类</option>
							{foreach $menus as $menu} {eq name='menu.id' value='$vo.goods_category|default=0'}
							<option selected value='{$menu.id}'>{$menu.spl}{$menu.name}</option>
							{else/}
							<option value='{$menu.id}'>{$menu.spl}{$menu.name}</option>
							{/eq} {/foreach}
						</select>
					</div>
				</div>

				<div class="layui-form-item">
					<label class="layui-form-label">价格</label>
					<div class="layui-input-block">
						<input type="number" name="goods_price" value='{$vo.goods_price|default=""}' required="required" title="请输入价格" placeholder="请输入价格" class="layui-input">
					</div>
				</div>

				<div class="layui-form-item">
				<label class="layui-form-label">库存</label>
				<div class="layui-input-block">
				<input type="text" name="goods_storage" value='{$vo.goods_storage|default=""}' required="required"  title="请输入库存" placeholder="请输入库存" class="layui-input">
				</div>
				<!--</div>-->

				<!--<div class="layui-form-item">
					<label class="layui-form-label">是否新品</label>
					<div class="layui-input-block">
						<input name="goods_new" value="1" title="是" {eq name='1' value='$vo.is_check|default=1' }checked="" {/eq} type="radio">
						<input name="goods_new" value="0" title="否" {eq name='0' value='$vo.is_check|default=0' }checked="" {/eq} type="radio">
					</div>
				</div>-->

				<!--<div class="layui-form-item">
					<label class="layui-form-label">是否热门</label>
					<div class="layui-input-block">
						<input name="goods_hot" value="1" title="是" {eq name='1' value='$vo.goods_hot|default=1' }checked="" {/eq} type="radio">
						<input name="goods_hot" value="0" title="否" {eq name='0' value='$vo.goods_hot|default=0' }checked="" {/eq} type="radio">
					</div>
				</div>-->

				<!--<div class="layui-form-item">
					<label class="layui-form-label">是否推荐</label>
					<div class="layui-input-block">
						<input name="goods_commend" value="1" title="是" {eq name='1' value='$vo.goods_commend|default=1' }checked="" {/eq} type="radio">
						<input name="goods_commend" value="0" title="否" {eq name='0' value='$vo.goods_commend|default=0' }checked="" {/eq} type="radio">
					</div>
				</div>-->
				
				<div class="layui-form-item">
					<label class="layui-form-label">状态</label>
					<div class="layui-input-block">
						<input name="goods_state" value="0" title="放入仓库" {eq name='0' value='$vo.goods_state|default=0' }checked="" {/eq} type="radio">
						<input name="goods_state" value="10" title="违规（禁售）" {eq name='10' value='$vo.goods_state|default=10' }checked="" {/eq} type="radio">
						<input name="goods_state" value="1" title="在售中" {eq name='1' value='$vo.goods_state|default=1' }checked="" {/eq} type="radio">
					</div>
				</div>
				

				<div class="layui-form-item">
					<label class="layui-form-label">封面图片</label>
					<div class='layui-input-block'>

						<!-- todo 默认图片设置 -->
						<img data-tips-image style="height:auto;max-height:32px;min-width:32px" src="{$vo.image_id|default='static/admin/theme/default/img/image.png'}" />
						<input type="hidden" name="image_id" onchange="$(this).prev('img').attr('src', this.value)" value="{$vo.image_id|default=''}" class="layui-input">
						<a class="btn btn-link" data-file="one" data-type="ico,png,jpg" data-field="image_id">上传图片</a>
						<!--<p>建议上传商品图片的尺寸为xx px。</p>-->
					</div>
				</div>

				<div class="layui-form-item">
					<label class="layui-form-label">介绍</label>
					<div class="layui-input-block">
						<textarea placeholder="请输入介绍" title="请输入介绍" class="layui-textarea" name="description">{$vo.description|default=""}</textarea>
					</div>
				</div>

			</div>

		</div>
	</div>

	<div class="hr-line-dashed"></div>
	<div class="layui-form-item text-center">
		<input type="hidden" name="create_time" value="{:date('Y-m-d')}">
		<input type="hidden" name="create_by" value="{$user.create_by}"> {if isset($vo['id'])}<input type='hidden' value='{$vo.id}' name='id' />{/if}
		<button class="layui-btn" lay-submit="" lay-filter="submit">保存数据</button>
		<button type='button' data-open='{:url("$classuri/index")}' class="layui-btn layui-btn-danger">返回列表</button>
	</div>

</form>

<script>
	window.form.render();
</script>

<script>
	layui.use(['form', 'laydate', 'element'], function() {
		var form = layui.form,
			layer = layui.layer,
			laydate = layui.laydate,
			element = layui.element; //选项卡 依赖element 模块
	});
</script>

<script>
	$(function() {

		require(['ueditor'], function() {

			/*! 实例富文本编辑器  */
			var editor, $item;
			/*! 默认编辑第一篇图文 */
			editor = window.createEditor('[name="description"]', 'basic');

			/*! 编辑器初始化成功 */
			editor.ready(function() {
				var $form = $('form[name="article"]'),
					$body = $('body');
				$form.validate();
			});
		});
	});
</script>

{/block}